package com.star.percalservice.controller;

import com.star.percalservice.model.dto.PaperDTO;
import com.star.percalservice.model.entity.Paper;
import com.star.percalservice.service.PaperService;
import com.star.percalservice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/paper")
public class PaperController {

    @Autowired
    private PaperService paperService;

    @PostMapping("/list")
    public R list(@RequestBody PaperDTO paperDTO) {
        return paperService.list(paperDTO);
    }

    @PostMapping("/add")
    public R add(@RequestBody Paper paper) {
        return paperService.add(paper);
    }

    @PostMapping("/update")
    public R update(@RequestBody Paper paper) {
        return paperService.update(paper);
    }

    @PostMapping("/delete")
    public R delete(Integer id) {
        return paperService.delete(id);
    }
}
